#version 450
#extension GL_ARB_separate_shader_objects : enable

layout(binding = 0) uniform UniformBufferObject {
    mat4 model;
    mat4 view;
    mat4 proj;
    vec4 lightPos;
	vec4 cameraPos;
    vec2 uvScale;
} vertUbo;

layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec3 inNormal;
layout(location = 2) in vec3 inTangent;
layout(location = 3) in vec3 inBitangent;
layout(location = 4) in vec2 inTexC;

layout(location = 0) out vec3 outPosition;
layout(location = 1) out vec3 outNormal;
layout(location = 2) out vec3 outTangent;
layout(location = 3) out vec3 outBitangent;
layout(location = 4) out vec3 outLightPos;
layout(location = 5) out vec3 outCameraPos;
layout(location = 6) out vec2 outTexC;

void main() {
    gl_Position = vertUbo.proj * vertUbo.view * vertUbo.model * vec4(inPosition, 1.0);
    outPosition = vec3(vertUbo.model * vec4(inPosition, 1.0));

    // outNormal = vec3(vertUbo.model * vec4(inNormal, 1.0));
    // outTangent = vec3(vertUbo.model * vec4(inTangent, 1.0));
    // outBitangent = vec3(vertUbo.model * vec4(inBitangent, 1.0));

    outNormal = mat3(vertUbo.model) * inNormal;
    outTangent = mat3(vertUbo.model) * inTangent;
    outBitangent = mat3(vertUbo.model) * inBitangent;

    outTexC.x = inTexC.x * vertUbo.uvScale.x;
    outTexC.y = inTexC.y * vertUbo.uvScale.y;
    outLightPos = vec3(vertUbo.lightPos);
    outCameraPos = vec3(vertUbo.cameraPos);
}